using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
namespace Coding4Fun.Phone.Controls
{
	public class ActionPopUp<T, TPopUpResult> : PopUp<T, TPopUpResult>
	{
		private const string string_0 = "actionButtonArea";
		protected Panel ActionButtonArea;
		public readonly DependencyProperty ActionPopUpButtonsProperty = DependencyProperty.Register("ActionPopUpButtons", typeof(List<Button>), typeof(ActionPopUp<T, TPopUpResult>), new PropertyMetadata(new List<Button>(), new PropertyChangedCallback(ActionPopUp<T, TPopUpResult>.OnActionPopUpButtonsChanged)));
		public List<Button> ActionPopUpButtons
		{
			get
			{
				return (List<Button>)base.GetValue(this.ActionPopUpButtonsProperty);
			}
			set
			{
				base.SetValue(this.ActionPopUpButtonsProperty, value);
			}
		}
		public override void OnApplyTemplate()
		{
			base.Focus();
			base.OnApplyTemplate();
			this.ActionButtonArea = (base.GetTemplateChild("actionButtonArea") as Panel);
			this.method_4();
		}
		private static void OnActionPopUpButtonsChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			ActionPopUp<T, TPopUpResult> actionPopUp = (ActionPopUp<T, TPopUpResult>)dependencyObject_0;
			if (actionPopUp != null && dependencyPropertyChangedEventArgs_0.get_NewValue() != dependencyPropertyChangedEventArgs_0.get_OldValue())
			{
				actionPopUp.method_4();
			}
		}
		private void method_4()
		{
			if (this.ActionButtonArea == null)
			{
				return;
			}
			this.ActionButtonArea.get_Children().Clear();
			using (List<Button>.Enumerator enumerator = this.ActionPopUpButtons.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					Button current = enumerator.get_Current();
					this.ActionButtonArea.get_Children().Add(current);
				}
			}
		}
	}
}
